<template>
  
  <ApplyItem v-for="(item,index) in applyList" :apply-item="item" :index="index" :key="item.applyId" @info="openInfo"></ApplyItem>
  
  
  <ApplyInfo ref="info" @permit="remove"></ApplyInfo>
  
</template>

<script>

import axios from "../../utils/MyAxios";
import qs from "qs";
import {ElMessage} from "element-plus";
import ApplyItem from "./ApplyItem";
import ApplyInfo from "./ApplyInfo";

let list = [
  {
    applyId: 5,
    applyDate: 2019,
    type: "claim",
    title: "AI AI AI",
    author: "谭火彬"
  }
]

export default {
  name: "ApplyList",
  created() {
    let data={
      managerId: sessionStorage.getItem("managerId")
    }
    axios.post('/api/manager/apply/list',qs.stringify(data))
    .then(res=>{
      console.log(res);
      data = res.data;
      if(data.code!==0){
        ElMessage.error(data.msg);
      }else{
        this.applyList = data.data;
      }
    })
    
  },
  data(){
    return{
      applyList: []
      
    }
  },
  methods:{
    openInfo(applyId,index){
      this.$refs.info.openInfo(applyId,index);
    },
    remove(index){
      this.applyList.splice(index,1);
    }
  },
  components:{
    ApplyItem,ApplyInfo
  }
}
</script>

<style scoped>

</style>